Feature envy

코드 악취 중 하나. 다른 모듈에 있는 데이터나 기능을 너무 많이 가져다 쓰는 상황.

A classic case of Feature Envy occurs when a function in one module spends more time communicating with functions or data inside another module than it does within its own module. We’ve lost count of the times we’ve seen a function invoking half-a-dozen getter methods on another object to calculate some value. —Chapter 3, Refactoring: Improving the design of existing code

관련 리팩토링

  • Move function
  • Extract function

2024 © ak